package com.threefood.action;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.threefood.model.User;
import com.threefood.service.UserService;

/**
 * Action类
 * 
 * @author lqs
 * 
 */
public class LoginAction extends ActionSupport {

    private static final long serialVersionUID = -1394472702170759717L;
    private User user;
    private UserService userService;

    public String login() throws Exception {
        User u = getUser();
        boolean isSuccess = userService.login(u);
        if (isSuccess) {
            return Action.SUCCESS;
        } else {
            return Action.ERROR;
        }
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public UserService getUserService() {
        return userService;
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }

}
